<template>
    <ul class="pic-list">
        <li v-for="(item,index) in  peopleList" :key="index" @click="toDetail(item)">
            <img :src="item.picture" />
            <p>{{item.pname}}</p>
        </li>
    </ul>
    
</template>

<script>
export default {
    props:{
        type:''
    },
    components:{
    },
    data(){
        return {
            peopleList:[]
        }
    },
    mounted(){
        this.getPersonListFn();
    },
    methods:{
        getPersonListFn(){
            const {type}= this;
            var params={
                type
            }
            this.centralControl.axios.centralControl(
                'getPersonList',
                res => {
                    this.peopleList=res;
                },
                params
            );
            
        },
        toDetail(item){
            localStorage.setItem('peopleDetail',JSON.stringify(item))
            this.$router.push({path:"/teacherDetail",query:{type:this.type}})
        }
    }
}
</script>

<style lang="less" scoped>
ul.pic-list {
    padding: 20px 0 10px;
}
ul.pic-list li {
    float: left;
    margin: 10px 35px 5px 0;
}
ul.pic-list li  {
    color: #666;
}
img {
    width: 150px;
    height: 200px;
}
ul.pic-list li p {
    padding: 15px 0;
    color: #000;
    text-align: center;
}
</style>